package com.zfdang.touchhelper.tool;

import android.util.Log;

import java.io.PrintWriter;
import java.io.StringWriter;


/**
 * @author Aivin
 */
public class LyLog {
    public static void showLog(String msg) {
        StackTraceElement[] stackTrace = new Exception().getStackTrace();
        String methodName = stackTrace[1].getMethodName();
        Log.i("dengpanwen", "[" + methodName + "]--->" + msg);
    }


    public static void showErrorLog(String msg) {
        StackTraceElement[] stackTrace = new Exception().getStackTrace();
        String methodName = stackTrace[1].getMethodName();
        Log.e("dengpanwen", "[" + methodName + "]--->" + msg);
    }


    static public void showTraceStackInString(String tag, Throwable e) {
        StringWriter sw = new StringWriter();
        PrintWriter pw = new PrintWriter(sw);
        if (e != null) {
            e.printStackTrace(pw);
        }
        Log.e(tag, sw.toString());
    }

}
